package com.whenJay;

import javax.servlet.ServletConfig;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;


public class ForwardServlet extends HttpServlet {
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        req.setCharacterEncoding("utf-8");
        resp.setContentType("text/html;charset=utf-8");
        ServletContext context = this.getServletContext();
        ServletConfig servletConfig = this.getServletConfig();
        String name = req.getParameter("name");
        String age = req.getParameter("age");
        String sno = req.getParameter("sno");
        String school = context.getInitParameter("学校");
        String classes = servletConfig.getInitParameter("班级");
        resp.getWriter().write(" 姓名: "+name+" 年龄: "+age+" 学号: "+sno + " 学校: "+school +" 班级:"+classes );
    }
}


